import 'package:flutter/material.dart';
import 'package:flutter_develop_template/common/mvvm/base_model.dart';

class HomeListModel extends BaseModel {
	int? curPage;
	List<Datas>? datas;
	int? offset;
	bool? over;
	int? pageCount;
	int? size;
	int? total;

	ValueNotifier<int> tapNum = ValueNotifier<int>(0); // 点击次数

	@override
  void onDispose() {
		tapNum.dispose();
    super.onDispose();
  }

	HomeListModel(
			{this.curPage,
				this.datas,
				this.offset,
				this.over,
				this.pageCount,
				this.size,
				this.total});

	HomeListModel.fromJson(Map<String, dynamic> json) {
		curPage = json['curPage'];
		if (json['datas'] != null) {
			datas = <Datas>[];
			json['datas'].forEach((v) {
				datas!.add(new Datas.fromJson(v));
			});
		}
		offset = json['offset'];
		over = json['over'];
		pageCount = json['pageCount'];
		size = json['size'];
		total = json['total'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['curPage'] = this.curPage;
		if (this.datas != null) {
			data['datas'] = this.datas!.map((v) => v.toJson()).toList();
		}
		data['offset'] = this.offset;
		data['over'] = this.over;
		data['pageCount'] = this.pageCount;
		data['size'] = this.size;
		data['total'] = this.total;
		return data;
	}
}

class Datas {
	bool? adminAdd;
	String? apkLink;
	int? audit;
	String? author;
	bool? canEdit;
	int? chapterId;
	String? chapterName;
	bool? collect;
	int? courseId;
	String? desc;
	String? descMd;
	String? envelopePic;
	bool? fresh;
	String? host;
	int? id;
	bool? isAdminAdd;
	String? link;
	String? niceDate;
	String? niceShareDate;
	String? origin;
	String? prefix;
	String? projectLink;
	int? publishTime;
	int? realSuperChapterId;
	int? selfVisible;
	int? shareDate;
	String? shareUser;
	int? superChapterId;
	String? superChapterName;
	List<Tags>? tags;
	String? title;
	int? type;
	int? userId;
	int? visible;
	int? zan;

	Datas(
			{this.adminAdd,
				this.apkLink,
				this.audit,
				this.author,
				this.canEdit,
				this.chapterId,
				this.chapterName,
				this.collect,
				this.courseId,
				this.desc,
				this.descMd,
				this.envelopePic,
				this.fresh,
				this.host,
				this.id,
				this.isAdminAdd,
				this.link,
				this.niceDate,
				this.niceShareDate,
				this.origin,
				this.prefix,
				this.projectLink,
				this.publishTime,
				this.realSuperChapterId,
				this.selfVisible,
				this.shareDate,
				this.shareUser,
				this.superChapterId,
				this.superChapterName,
				this.tags,
				this.title,
				this.type,
				this.userId,
				this.visible,
				this.zan});

	Datas.fromJson(Map<String, dynamic> json) {
		adminAdd = json['adminAdd'];
		apkLink = json['apkLink'];
		audit = json['audit'];
		author = json['author'];
		canEdit = json['canEdit'];
		chapterId = json['chapterId'];
		chapterName = json['chapterName'];
		collect = json['collect'];
		courseId = json['courseId'];
		desc = json['desc'];
		descMd = json['descMd'];
		envelopePic = json['envelopePic'];
		fresh = json['fresh'];
		host = json['host'];
		id = json['id'];
		isAdminAdd = json['isAdminAdd'];
		link = json['link'];
		niceDate = json['niceDate'];
		niceShareDate = json['niceShareDate'];
		origin = json['origin'];
		prefix = json['prefix'];
		projectLink = json['projectLink'];
		publishTime = json['publishTime'];
		realSuperChapterId = json['realSuperChapterId'];
		selfVisible = json['selfVisible'];
		shareDate = json['shareDate'];
		shareUser = json['shareUser'];
		superChapterId = json['superChapterId'];
		superChapterName = json['superChapterName'];
		if (json['tags'] != null) {
			tags = <Tags>[];
			json['tags'].forEach((v) {
				tags!.add(new Tags.fromJson(v));
			});
		}
		title = json['title'];
		type = json['type'];
		userId = json['userId'];
		visible = json['visible'];
		zan = json['zan'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['adminAdd'] = this.adminAdd;
		data['apkLink'] = this.apkLink;
		data['audit'] = this.audit;
		data['author'] = this.author;
		data['canEdit'] = this.canEdit;
		data['chapterId'] = this.chapterId;
		data['chapterName'] = this.chapterName;
		data['collect'] = this.collect;
		data['courseId'] = this.courseId;
		data['desc'] = this.desc;
		data['descMd'] = this.descMd;
		data['envelopePic'] = this.envelopePic;
		data['fresh'] = this.fresh;
		data['host'] = this.host;
		data['id'] = this.id;
		data['isAdminAdd'] = this.isAdminAdd;
		data['link'] = this.link;
		data['niceDate'] = this.niceDate;
		data['niceShareDate'] = this.niceShareDate;
		data['origin'] = this.origin;
		data['prefix'] = this.prefix;
		data['projectLink'] = this.projectLink;
		data['publishTime'] = this.publishTime;
		data['realSuperChapterId'] = this.realSuperChapterId;
		data['selfVisible'] = this.selfVisible;
		data['shareDate'] = this.shareDate;
		data['shareUser'] = this.shareUser;
		data['superChapterId'] = this.superChapterId;
		data['superChapterName'] = this.superChapterName;
		if (this.tags != null) {
			data['tags'] = this.tags!.map((v) => v.toJson()).toList();
		}
		data['title'] = this.title;
		data['type'] = this.type;
		data['userId'] = this.userId;
		data['visible'] = this.visible;
		data['zan'] = this.zan;
		return data;
	}
}

class Tags {
	String? name;
	String? url;

	Tags({this.name, this.url});

	Tags.fromJson(Map<String, dynamic> json) {
		name = json['name'];
		url = json['url'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['name'] = this.name;
		data['url'] = this.url;
		return data;
	}
}
